<!DOCTYPE html>
<html class=" js csstransforms3d"><head>
	<meta charset="utf-8">
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>公共侧边栏</title>
	<link rel="stylesheet" href="css/base.css">
	<link rel="stylesheet" href="css/page.css">
	<!--[if lte IE 8]>
	<link href="css/ie8.css" rel="stylesheet" type="text/css"/>
	<![endif]-->
	<script type="text/javascript" src="js/jquery.min.js"></script>
	<script type="text/javascript" src="js/main.js"></script>
	<script type="text/javascript" src="js/modernizr.js"></script>
	<!--[if IE]>
	<script src="http://libs.useso.com/js/html5shiv/3.7/html5shiv.min.js"></script>
	<![endif]-->
</head>

<body>
	<!--side S-->
	<div class="super-side-menu">
		<div class="logo"><img src="images/logo.png"></a></div>
		
		<div class="side-menu">
			<ul>
				<li id="user"><a href="user" target="Mainindex"><i class="ico-1"></i>用户管理</a></li>
				<li id="review"><a href="review" target="Mainindex"><i class="ico-2"></i>往期内容</a></li>
				<li id="listen"><a href="listen" target="Mainindex"><i class="ico-3"></i>一起听</a></li>
				<li id="learn"><a href="learn" target="Mainindex"><i class="ico-4"></i>一起学</a></li>
				<li id="read"><a href="read" target="Mainindex"><i class="ico-5"></i>一起读</a></li>
			</ul>
		</div>
	</div>
	<!--side E-->

<script type="text/javascript">
	$(function(){
		$('.side-menu li').click(function(){
			$(this).addClass('on').siblings().removeClass('on');
		})
		this.initUserRole();
	}.bind(this))
    function initUserRole(){
        $.ajax({
            type: 'POST',
            url: '/getRolesByUserId',
            data: {"id":sessionStorage.getItem("id")},
            dataType:'json',
            success:function(data, status){
                let changeFirstPage = true;
                let iframeSrc = "";
                if(data.length == 0){
                    iframeSrc = "user.html"
				}

                for(let i=0;i<data.length;i++){
                    let infoRole = data[i];
                    if(infoRole.status == 0){
                        $("#"+infoRole.url).hide();
					}else{
                        $("#"+infoRole.url).show();
                        if(changeFirstPage){
                            iframeSrc = infoRole.url+".html";
                            changeFirstPage = false;
						}
					}

                }
                window.parent.changeIframeSrc(iframeSrc);
            }.bind(this),
            error:function(err, status){
            }});
	}
</script>

</body></html>